﻿using Jayden.Dll.Web.HtmlControls;
using Jayden.Dll.Web;

namespace Jayden.Site.Sterdent.Dll
{
	public class LangA : A
	{
		public void ProcessRequest(HttpHandlerContext context)
		{
			if (HRef != null)
			{
				Uri uri = new Uri(context.Uri, HRef, false);
				UriAccess access;
				Uri managedUri = context.Handler.UriManager.Manage(uri, out access);
				if (managedUri != null && !uri.Equals(managedUri))
				{
					Uri langUri = managedUri.Clone();
					langUri.Lang = context.Lang;
					langUri = context.Handler.UriManager.Virtualize(langUri);
					HRef = langUri.ToAbsoluteString(true);
				}
			}
		}

		public override void ProcessHtmlRequest(HttpHandlerContext context)
		{
			base.ProcessHtmlRequest(context);
			ProcessRequest(context);
		}
	}
}